package cn.com.dpc.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class UserTable extends SQLiteOpenHelper {
	public static String tableName = "user";
	public static final String IP = "ip";
	public static final String USERID = "userId";
	public static final String PASSWORD = "password";
	public static final int VERSION = 1;

	// public static final String numRow = "mobileNum";

	public UserTable(Context context, CursorFactory factory) {
		super(context, UserTable.tableName, factory, UserTable.VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE IF NOT EXISTS " + tableName + " (" + IP
				+ " VARCHAR PRIMARY KEY," + USERID + " VARCHAR," + PASSWORD
				+ " VARCHAR)");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + tableName);
		onCreate(db);
	}

}
